package com.elai.baseconfig.service.impl;

import java.util.List;
import com.elai.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.elai.baseconfig.mapper.ChannelMapper;
import com.elai.baseconfig.domain.ChannelDO;
import com.elai.baseconfig.service.ChannelService;

/**
 * 触达通道Service业务层处理
 *
 * @author elai
 * @date 2021-04-03
 */
@Service
public class ChannelServiceImpl implements ChannelService
{
    @Autowired
    private ChannelMapper channelMapper;

    /**
     * 查询触达通道
     *
     * @param id 触达通道ID
     * @return 触达通道
     */
    @Override
    public ChannelDO selectChannelById(Long id)
    {
        return channelMapper.selectChannelById(id);
    }

    /**
     * 查询触达通道列表
     *
     * @param channel 触达通道
     * @return 触达通道
     */
    @Override
    public List<ChannelDO> selectChannelList(ChannelDO channel)
    {
        return channelMapper.selectChannelList(channel);
    }

    /**
     * 新增触达通道
     *
     * @param channel 触达通道
     * @return 结果
     */
    @Override
    public int insertChannel(ChannelDO channel)
    {
        channel.setCreateTime(DateUtils.getNowDate());
    channel.setUpdateTime(DateUtils.getNowDate());
        return channelMapper.insertChannel(channel);
    }

    /**
     * 修改触达通道
     *
     * @param channel 触达通道
     * @return 结果
     */
    @Override
    public int updateChannel(ChannelDO channel)
    {
        channel.setUpdateTime(DateUtils.getNowDate());
        return channelMapper.updateChannel(channel);
    }

    /**
     * 批量删除触达通道
     *
     * @param ids 需要删除的触达通道ID
     * @return 结果
     */
    @Override
    public int deleteChannelByIds(Long[] ids)
    {
        return channelMapper.deleteChannelByIds(ids);
    }

    /**
     * 删除触达通道信息
     *
     * @param id 触达通道ID
     * @return 结果
     */
    @Override
    public int deleteChannelById(Long id)
    {
        return channelMapper.deleteChannelById(id);
    }
}
